Full source code website bán hàng thương mại điện tử gần giống shopee
468.896 lượt xem;
1 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
2 <tr><td width="45%" height="20" align="center" class="title">
3 Danh sách Shop miễn phí | <a href="?act=users_add"><font color="#ffffff">Thên User</font></a>
4 </td></tr>
5 <tr><td>
6 <?
7 switch ($_GET['action'])
8 {
9 case 'del' :
10 $id = $_GET['id'];
11 $sql = "delete from user_shop where id='".$id."'";
12 @$result = mysql_query($sql,$con);
13 if ($result) echo "<p align=center class='err'>Đã xóa thành công</p>";
14 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
15 break;
16 }
17 ?>
18
19 <?
20 if (isset($_POST['ButDel'])) {
21 $cnt=0;
22 foreach ($_POST['chk'] as $id)
23 {
24 @$result = mysql_query("delete from user_shop where id='".$id."'",$con);
25 if ($result) $cnt++;
26 }
27 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
28 }
29 ?>
30 <?
31 $page = $_GET["page"];
32 $MAXPAGE=50;
33 $p=0;
34 if ($page!='') $p=$page;
35 ?>
36
37
38 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
39 <input type="hidden" name="act" value="users_shop">
40 <input type=hidden name="page" value="<? echo $page; ?>">
41 <?
42 function taotrang($sql,$link,$nitem,$itemcurrent)
43 { global $con;
44 $ret="";
45 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
46 $value = mysql_fetch_array($result);
47 $plus = (($value['cnt'] % $nitem)>0);
48 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
49 {
50 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
51 else $ret .= ($i+1)." ";
52 }
53 return $ret;
54 }
55 $pageindex=taotrang("select count(*) from user_shop where level_shop=3","./?act=users_shop"."&page=",$MAXPAGE,$page);
56 ?>
57
58 <table cellspacing="0" cellpadding="0">
59 <tr>
60 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
61 </tr>
62 </table>
63 </td></tr>
64
65
66
67 <tr><td>
68 <!-- begin danh sach -->
69 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
70 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
71 <tr class="title">
72 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
73 <td nowrap class="title"> </td>
74 <td nowrap class="title"> </td>
75 <td>ID</td>
76 <td>Tên đăng nhập</td>
77 <td>Mật khẩu</td>
78 <td>Thứ tự</td>
79 <td>Quyền hạn</td>
80 </tr>
81 <? $sql=mysql_query("SELECT * FROM user_shop where level_shop=3 order by id desc");
82 $i=0;
83 while($row=mysql_fetch_array($sql))
84 {
85 $i++;
86 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
87 ?>
88
89 <tr bgcolor="<? echo $color;?>">
90 <td width="20" align="center" class="smallfont"><input type="checkbox" name="chk[]" value="<? echo $row['Id']; ?>"></td>
91 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
92 <a href="./?act=users_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
93 Sửa</a></td>
94 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
95 <a href="./?act=users_shop&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
96 Xoá</a></td>
97 <td><? echo $row['id'];?></td>
98 <td><? echo $row['user'];?></td>
99 <td><? echo $row['pass'];?></td>
100 <td><? echo $row['thutu'];?></td>
101 <td><? if($row['level_shop']==0) echo "<font color=red>Shop Vip</font>";
102 else echo "<font color=blue>Shop miễn phí</font>";
103 ?></td>
104
105 </tr>
106 <?}?>
107 </table>
108 <!-- end danh sach -->
109
110
111
112 </td></tr>
113 </table>
114 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button" style="padding: 0">
115 <input type="hidden" name="act" value="users_shop">
116 </form>
117 <script language="JavaScript">
118 function chkallClick(o) {
119 var form = document.frmList;
120 for (var i = 0; i < form.elements.length; i++) {
121 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
122 form.elements[i].checked = document.frmList.chkall.checked;
123 }
124 }
125 }
126 </script>
2 <tr><td width="45%" height="20" align="center" class="title">
3 Danh sách Shop miễn phí | <a href="?act=users_add"><font color="#ffffff">Thên User</font></a>
4 </td></tr>
5 <tr><td>
6 <?
7 switch ($_GET['action'])
8 {
9 case 'del' :
10 $id = $_GET['id'];
11 $sql = "delete from user_shop where id='".$id."'";
12 @$result = mysql_query($sql,$con);
13 if ($result) echo "<p align=center class='err'>Đã xóa thành công</p>";
14 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
15 break;
16 }
17 ?>
18
19 <?
20 if (isset($_POST['ButDel'])) {
21 $cnt=0;
22 foreach ($_POST['chk'] as $id)
23 {
24 @$result = mysql_query("delete from user_shop where id='".$id."'",$con);
25 if ($result) $cnt++;
26 }
27 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
28 }
29 ?>
30 <?
31 $page = $_GET["page"];
32 $MAXPAGE=50;
33 $p=0;
34 if ($page!='') $p=$page;
35 ?>
36
37
38 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
39 <input type="hidden" name="act" value="users_shop">
40 <input type=hidden name="page" value="<? echo $page; ?>">
41 <?
42 function taotrang($sql,$link,$nitem,$itemcurrent)
43 { global $con;
44 $ret="";
45 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
46 $value = mysql_fetch_array($result);
47 $plus = (($value['cnt'] % $nitem)>0);
48 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
49 {
50 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
51 else $ret .= ($i+1)." ";
52 }
53 return $ret;
54 }
55 $pageindex=taotrang("select count(*) from user_shop where level_shop=3","./?act=users_shop"."&page=",$MAXPAGE,$page);
56 ?>
57
58 <table cellspacing="0" cellpadding="0">
59 <tr>
60 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
61 </tr>
62 </table>
63 </td></tr>
64
65
66
67 <tr><td>
68 <!-- begin danh sach -->
69 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
70 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
71 <tr class="title">
72 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
73 <td nowrap class="title"> </td>
74 <td nowrap class="title"> </td>
75 <td>ID</td>
76 <td>Tên đăng nhập</td>
77 <td>Mật khẩu</td>
78 <td>Thứ tự</td>
79 <td>Quyền hạn</td>
80 </tr>
81 <? $sql=mysql_query("SELECT * FROM user_shop where level_shop=3 order by id desc");
82 $i=0;
83 while($row=mysql_fetch_array($sql))
84 {
85 $i++;
86 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
87 ?>
88
89 <tr bgcolor="<? echo $color;?>">
90 <td width="20" align="center" class="smallfont"><input type="checkbox" name="chk[]" value="<? echo $row['Id']; ?>"></td>
91 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
92 <a href="./?act=users_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
93 Sửa</a></td>
94 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
95 <a href="./?act=users_shop&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
96 Xoá</a></td>
97 <td><? echo $row['id'];?></td>
98 <td><? echo $row['user'];?></td>
99 <td><? echo $row['pass'];?></td>
100 <td><? echo $row['thutu'];?></td>
101 <td><? if($row['level_shop']==0) echo "<font color=red>Shop Vip</font>";
102 else echo "<font color=blue>Shop miễn phí</font>";
103 ?></td>
104
105 </tr>
106 <?}?>
107 </table>
108 <!-- end danh sach -->
109
110
111
112 </td></tr>
113 </table>
114 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button" style="padding: 0">
115 <input type="hidden" name="act" value="users_shop">
116 </form>
117 <script language="JavaScript">
118 function chkallClick(o) {
119 var form = document.frmList;
120 for (var i = 0; i < form.elements.length; i++) {
121 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
122 form.elements[i].checked = document.frmList.chkall.checked;
123 }
124 }
125 }
126 </script>